package com.jrx.anytxn.param.mapper.ext;

import com.jrx.anytxn.param.entity.TlBillTransInnerSummary;
import com.jrx.anytxn.param.mapper.base.TlBillTransInnerSummaryMapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public interface ExtTlBillTransInnerSummaryMapper extends TlBillTransInnerSummaryMapper {

    int countByTenantIdAndBusDateAndBillType(@Param("tenantId") String tenantId,
                                             @Param("businessDate") Date businessDate,
                                             @Param("billType") String billType);

    BigDecimal sumByTenantIdAndBusDateAndBillType(@Param("tenantId") String tenantId,
                                                  @Param("businessDate") Date businessDate,
                                                  @Param("billType") String billType);

    int countByTenantIdBusDateAndInnerStatusAndBillType(@Param("tenantId") String tenantId,
                                                        @Param("businessDate") Date businessDate,
                                                        @Param("innerStatus") String innerStatus,
                                                        @Param("billType") String billType,
                                                        @Param("thirdChannel") String thirdChannel)
            ;

    BigDecimal sumByTenantIdBusDateAndInnerStatusAndBillType(@Param("tenantId") String tenantId,
                                                             @Param("businessDate") Date businessDate,
                                                             @Param("innerStatus") String innerStatus,
                                                             @Param("billType") String billType,
                                                             @Param("thirdChannel") String thirdChannel);

    /**
     * 保存
     *
     * @param item
     * @return int
     */
    int insertbatch(List<TlBillTransInnerSummary> item);

    /**
     * 根据业务日期及分库信息删除
     *
     * @param dataFrom     String
     * @param businessDate Date
     * @return int
     */
    int deleteByFromAndBusDate(@Param("dataFrom") String dataFrom,
                               @Param("businessDate") Date businessDate);

    /**
     * 根据业务日期及分库信息删除
     *
     * @param dataFrom     String
     * @param businessDate Date
     * @return int
     */
    int deleteByFromAndBusDateAndThirdChannel(@Param("dataFrom") String dataFrom,
                                              @Param("businessDate") Date businessDate, @Param("thirdChannel") String thirdChannel);
}
